﻿using System.Collections.Generic;

namespace DitaImport
{
	/// <summary>
	/// Collection of text blocks - creates topic text xml
	/// </summary>
	/// <remarks>Use the <see cref="ToString()"/> method to get XML</remarks>
	public class TextBlocks : List<TextBlock>
	{
		#region Methods (1) 

		// Public Methods (1) 

		/// <summary>
		/// Returns a string representation of this <see cref="TextBlocks"/>
		/// </summary>
		/// <returns>String representation of this <see cref="TextBlocks"/></returns>
		public override string ToString()
		{
			System.Text.StringBuilder sb = new System.Text.StringBuilder();  //Initialize the string builder that will store the string
			sb.Append("<Text>");  //Append the opening text tag
			foreach (TextBlock textBlock in this)  //Iterate through each text block in the list
			{
				sb.Append(textBlock.ToString());  //Append the string representation of the text block
			}
			sb.Append("</Text>");  //Append the closing text tag
			return sb.ToString();  //Return the string
		}

		#endregion Methods 
	}
}